<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>新品</title>
    <link rel="stylesheet" href="../../css/aui.css">
    <link rel="stylesheet" href="../../css/common.css">
    <script type="text/javascript" src="../../script/api.js"></script>
    <script language="JavaScript" src="../../script/vue.js"></script>
    <link rel="stylesheet" href="../../css/headerfooter.css">
    <script language="JavaScript" src="../../script/common.js"></script>
    <style>
        .sale-info {
            color: #9c9c9c;
            font-size: 0.5rem;
            display: inline-block;
        }
    </style>
</head>

<body>
    <div id="listbox">
        <header class="aui-bar aui-bar-nav" id="header">
            <a class="aui-pull-left aui-btn" onclick="closewin();">
                <span class="aui-iconfont aui-icon-left"></span>
            </a>
            <div class="aui-title">{{parentinfo.title}}</div>
        </header>
        <div class="active topheader" id="indexheader">
            <ul class="cf-content"  >
                <li class="cf-tab-item " :class="{'cur-cf-tab':tid==parentid}" @click="opennav($event,0)"><span>全部</span></li>
                <li class="cf-tab-item" :class="{'cur-cf-tab':tid==item.id}" v-for="item in topnav" @click="opennav($event,item.id)">
                    <span>{{item.title}}</span>
                </li>

            </ul>
        </div>
    </div>
    <script language="javascript">
        var pvm = new Vue({
            el: '#listbox',
            data: {
                tid: 0,
                parentid: 0,
                parentinfo: {},
                topnav: [],
            },
            methods: {
                opennav: function(e, tid) {
                    if (tid == 0) tid = this.parentid;
                   $page.switchnav(e,'cur-cf-tab');
                   pvm.opencontent(tid);
                },
                opencontent:function(tid){
                  var headerh = $api.dom("#listbox").offsetHeight;
                   $page.openfrm('product_sublist_frm' + tid, './sublist_frame.html', {
                      x: 0,
                      y: headerh,
                      h: api.winHeight - headerh
                  }, {
                      tid: tid
                  });
                },

                load_init: function() {
                    $page.get_data('/api/product/getpTypeInfo', 'post', {
                        tid: this.tid
                    }, function(ret) {
                        pvm.parentinfo = ret.data;
                        pvm.parentid = ret.data.id;
                    });
                    $page.get_data('/api/product/getTypeLevelList', 'post', {
                        tid: this.tid
                    }, function(ret) {
                        pvm.topnav = ret.data;
                         pvm.opencontent(pvm.tid);
                    });

                }
            }
        });

        apiready = function() {
          pageParam = api.pageParam;
          pvm.tid = pageParam.tid;
  $page.init();

            pvm.load_init();


        }
    </script>
</body>

</html>
